// 页面路径：store/index.js 
import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);//vue的插件机制

//Vuex.Store 构造器选项
const store = new Vuex.Store({
	state:{//存放状态
		"sever":"https://wdzbx.zsbike.com.cn:10787",
		userinfo: {
			userid:'',
			nickname:'',
			group_id:'',
		},
		isLogin: false,   //判断是否已登录
		api:{},
	},
	mutations: {
			login() {
				// 变更状态
				this.state.isLogin = true;
				this.state.userinfo.userid = uni.getStorageSync("userinfo.userid");
				this.state.userinfo.nickname = uni.getStorageSync("userinfo.nickname");
				this.state.userinfo.group_id = uni.getStorageSync("userinfo.group_id");
				console.log(this.state.userinfo.userid)
			}
		},
		actions:{
				addCountAction (context) {
				    context.commit('add')
				}
			}
})
export default store